<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查找订单</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/main.css">
    <link rel="stylesheet" href="../../static/css/public.css">
    <script src="../../static/js/jquery-3.4.1.min.js"></script>
    <script src="../../static/layui/layui.js"></script>
    <style>
        .t{
            width: 100px
        }
    </style>
</head>
<body>

    <div class="body">
        <h2 class="tablename">条件查找订单</h2>
        <hr class="layui-bg-gray">
        <div class="form">
            <br>
            <div class="form">
                <br>
                <form class="layui-form">

                    <div class="layui-form-item">
                        <label class="layui-form-label t">订单编号:</label>
                        <div class="layui-input-inline">
                            <input type="text" id="orderId" value="" autocomplete="off" 
                                   class="layui-input" >
                        </div>

                        <label class="layui-form-label t">包裹编号:</label>
                        <div class="layui-input-inline">
                            <input type="text" id="packageId" value="" autocomplete="off" 
                                   class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label t">实际派件时间:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="actualDistriTime" value="" 
                                       class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label t">预计派件时间:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="estiDistriTime" id="" value="" 
                                        autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label t">收件时间:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="receiveTime" value="" 
                                        autocomplete="off" class="layui-input">

                            </div>

                        </div>


                        <label class="layui-form-label t">收件员编号:</label>
                        <div class="layui-input-inline">
                            <input type="text" id="receiveCourierId" value="" 
                                   autocomplete="off" class="layui-input">
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label t">寄件客户编号:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="consignorId" value="" 
                                       class="layui-input">
                            </div>
                        </div>


                        <div class="layui-inline">
                            <label class="layui-form-label t">收件客户编号:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="consigneeId" value="" 
                                       class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label t">派件员编号:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="distributerId" value="" 
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label t">支付类型:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="payType" value="" 
                                       class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label t">费用:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="fee" value="" 
                                       class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label t">支付状态:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="payStatus" value="" 
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <br>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                            <!--                    <input class="layui-btn layui-btn-radius layui-btn-normal" type="button" onclick="sub()" value="提交">-->
                            <button class="layui-btn layui-btn-radius layui-btn-normal" lay-submit lay-filter="*">查询</button>
                            &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                            <button type="reset" class="layui-btn layui-btn-radius  layui-btn-danger">重置</button>
                        </div>
                    </div>
                    <br>
                </form>


            </div>



        </div>

    </div>
<script>

    layui.use('element', function(){
        var element = layui.element;

        //…
    });

    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#receiveTime'
        });
        laydate.render({
            elem: '#actualDistriTime'
        });
        laydate.render({
            elem: '#estiDistriTime'
        });

        form.on('submit(*)', function(){
            var ordersubmit = {
                "orderId" : document.getElementById('orderId').value,
                "packageId" : document.getElementById('packageId').value,
                "receiveTime" : document.getElementById('receiveTime').value,
                "receiveCourierId" : document.getElementById('receiveCourierId').value,
                "consignorId" : document.getElementById('consignorId').value,
                "distributerId" : document.getElementById('distributerId').value,
                "consigneeId" : document.getElementById('consigneeId').value,
                "estiDistriTime" : document.getElementById('estiDistriTime').value,
                "actualDistriTime" : document.getElementById('actualDistriTime').value,
                "payType" : document.getElementById('payType').value,
                "fee" : document.getElementById('fee').value,
                "payStatus" : document.getElementById('payStatus').value
            }
            layer.confirm('确定查询吗？', {
                btn: ['是的','取消'] //按钮
            }, function(){
                $.ajax({
                    url: 'http://localhost:8080/order/search',
                    type: 'POST',
                    contentType : 'application/json',
                    dataType: 'json',
                    data: JSON.stringify(ordersubmit),
                    success(res){
                        var obj = JSON.stringify(res);
                        console.log(obj)
                        console.log(res)
                        if(Object.keys(obj)[0] == 0){
                            localStorage.setItem('searchorder', obj);
                            var url = '../../pages/order/allsearchorder.html'
                            $(window).attr('location', url);
                            // layer.msg("查询成功", {icon: '1', time: 2000});

                        }
                        else layer.msg("查询失败", {icon: '2', time: 2000});
                    },
                    error(){
                        layer.msg('500！', {
                            time: 1000, //不自动关闭
                            icon: 'layui-icon-ok',
                        });
                    }
                })
            }, function(){
                layer.msg('已取消', {
                    time: 2000
                });
            });

            return false;
        })


    });
</script>


</body>
</html>